package org.ellwood.core.common.exception.common;

import java.text.MessageFormat;

/**
 * @ProjectName: ellwood-boot-pro
 * @PackageName: org.ellwood.core.common.exception.common
 * @ClassName: BusinessExceptionCustomAssert
 * @Description: // 业务异常自定义断言
 * @Author: Ellwood
 * @CreateDate: 2024/6/12 - 下午3:07
 * @Version: V1.0.0
 */
public interface BusinessExceptionCustomAssert extends IResponseEnum,CustomAssert {

    @Override
    default BaseException newException(Object... args) {
        String msg= MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this,args,msg);
    }

    @Override
    default BaseException newException(Throwable t, Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg, t);
    }

    default BaseException newException(String message,Object... args) {
        String formattedMessage = MessageFormat.format(message, args);
        return new BaseException(this, args, formattedMessage);
    }

}
